package rentadomus

class SearchByTypeController {

    def index() { 
        redirect(action: "main")
    }
    def main () {
        def type = ["------------","Apartment", "House", "Local","Office", "WareHouse"]
        
        def rec = params.CBPurpose
        if (rec==null || rec.equals("------------")){
            println ("Oye mi perro")
        }
        else{
            // this redirects to the correspondent form depending of the type of place
            switch(rec)
            {
                
                case "House":
                    redirect(controller:"House", action: "list")
                    break;
                case "Apartment":
                    redirect(controller:"Apartament", action: "list")
                    break;
                    
                case "Local":
                    redirect(controller:"Local", action: "list")
                    break;
                    
                case "Office":
                    redirect(controller:"Office", action: "list")
                    break;
                    
                case "WareHouse":
                    redirect(controller:"Warehouse", action: "list")
                    break;
            }
            println("Nos puedes llevar a la U de las americas?")
        }
        [sType:type]
        
    }
}
